<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../css/07-discounts.css">
    <link rel="stylesheet" href="../css/Common.css">
    <link rel="stylesheet" href="../css/media.css">
    <title>07-paging.html</title>
</head>
<body>
    <div class="paging-menu">

    </div>
</body>
</html>
<script src="../lib/jquery-1.12.4.min.js"></script>
<!-- 模板 -->
<script src="../js/template.js"></script>
<script type="text/template" id="menu">
    {{each result as val key}}
      <div class="menu" data-id="{{val.couponId}}">
              {{val.couponProductImg}}
             <div>{{val.couponProductName}}</div>
             <div>{{val.couponProductPrice}}</div>
             <div>{{val.couponProductTime}}</div>
      </div>
    {{/each}}
</script>

<script>
 menu();
  function menu(){
      $.ajax({
          url:'http://193.112.55.79:9090/api/getcouponproduct',
          type:'get',
          dataType:'json',
          data:{
               couponid: 0
               
            },
          success:function(res){
              
               template.config('escape',false)

               if(res){
                   var htmlStr=template('menu',res);

                   //动态渲染
                   $('.paging-menu').html(htmlStr);
               }
          }
          
      
      })
  }
</script>